<template>
  <div class="detail-content">
    <div class="detail-container">
      <div class="left-container">
        <div class="status-box">
          <div class="label">控制箱状态：</div>
          <div v-bind:class="['value', info.deviceStatus != 1 ? 'organe' : '']">
            {{ info.deviceStatus == 0 ? '离线' : (info.deviceStatus == 1 ? '运行正常' : '检修中') }}</div>
          <img v-if="info.deviceStatus == 1" class="status" src="@/assets/statuszc.png" />
          <img v-else class="status" src="@/assets/statusyc.png" />
        </div>
        <div class="jczt-box">
          <div class="title">
            <div class="circle"></div>
            监测状态
          </div>
          <div class="jklist">
            <div class="item" v-for="(item, index) in info.boxNumericals" :key="index">
              <div class="label">{{ item.deviceName }} {{ item.unit }}</div>
              <div class="value">{{ item.realData }}</div>
            </div>
          </div>
        </div>
      </div>
      <div class="zt-box">
        <div class="kgzt-box">
          <div class="title">
            <div class="circle"></div>
            开关状态
          </div>
          <div class="kgzt-content">
            <div class="list">
              <div class="item" v-for="(item, index) in info.boxSwitches" :key="index">
                <div class="kgztline">
                  <div v-bind:class="['line', item.deviceStatus != 1 ? 'lineguan' : '']">
                    {{ item.deviceStatus == 0 ? '离线' : (item.deviceStatus == 1 ? '开' : (item.deviceStatus == 2 ? '关' :
                      '故障')) }}
                    <img v-if="item.deviceStatus == 1" class="kai" src="@/assets/box/kai.png" />
                    <img v-else class="guan" src="@/assets/box/guan.png" />
                  </div>
                  <img v-if="item.deviceStatus == 1" class="status" src="@/assets/box/statuszc.png" />
                  <img v-else class="status" src="@/assets/box/statusyc.png" />
                </div>
                <div class="word">{{ item.deviceName }}</div>
              </div>
            </div>
            <div class="js-box" v-if="info.type == 0">
              <div class="title">
                <div class="circle"></div>
                进水模式
              </div>
              <div class="moshi">
                <div v-bind:class="['itemR', info.inWaterModel == 0 ? 'xz-item' : '']">
                  自流模式
                </div>
                <div v-bind:class="['itemL', info.inWaterModel == 1 ? 'xz-item' : '']">
                  轮换模式
                </div>
              </div>
            </div>
            <div class="ws-box" v-if="info.type == 2">
              <div class="title">
                <div class="circle"></div>
                尾水状态
              </div>
              <div class="wsmoshi">
                <div class="zlist">
                  <div v-bind:class="['itemR', info.tailWaterModel == 0 ? 'xz-item' : '']">
                    排污模式
                  </div>
                  <div v-bind:class="['itemC', info.tailWaterModel == 1 ? 'xz-item' : '']">
                    换水模式
                  </div>
                  <div v-bind:class="['itemC', info.tailWaterModel == 2 ? 'xz-item' : '']">
                    上清水模式
                  </div>
                  <div v-bind:class="['itemL', info.tailWaterModel == 3 ? 'xz-item' : '']">
                    故障
                  </div>
                </div>
              </div>
            </div>
            <div class="list" v-if="info.type == 0">
              <div class="item">
                <div class="kgztline">
                  <div v-bind:class="['line', info.inWaterModel != 1 ? 'lineguan' : '']">{{ info.inWaterModel == 1 ? '开' :
                    '关' }}
                    <img v-if="info.inWaterModel == 1" class="kai" src="@/assets/kai.png" />
                    <img v-else class="guan" src="@/assets/guan.png" />
                  </div>
                  <img v-if="info.inWaterModel == 1" class="status" src="@/assets/box/statuszc.png" />
                  <img v-else class="status" src="@/assets/box/statusyc.png" />
                </div>
                <div class="word">{{ info.inWaterModel == 0 ? '自流模式' : '轮换模式' }}</div>
              </div>
            </div>
            <div class="list" v-if="info.type == 2">
              <div class="item">
                <div class="kgztline">
                  <div v-bind:class="['line', info.tailWaterModel != 1 ? 'lineguan' : '']">{{ info.tailWaterModel == 1 ?
                    '开' : '关' }}
                    <img v-if="info.tailWaterModel == 1" class="kai" src="@/assets/kai.png" />
                    <img v-else class="guan" src="@/assets/guan.png" />
                  </div>
                  <img v-if="info.tailWaterModel == 1" class="status" src="@/assets/box/statuszc.png" />
                  <img v-else class="status" src="@/assets/box/statusyc.png" />
                </div>
                <div class="word">
                  {{ info.tailWaterModel == 0 ? '排污模式' : (info.tailWaterModel == 1 ? '换水模式' : (info.tailWaterModel == 2 ?
                    '上清水模式' : '故障')) }}
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>
<script>

import {
  getObjBoxInfo,
} from "@/api/system";
export default {
  components: {
  },
  // 表格数据
  data() {
    return {
      boxId: '',
      info: {},
      cs: 1
    };
  },
  created() {
    console.log(1);
    this.boxId = this.$route.query.id;
    console.log(this.boxId);
  },
  // 初始化加载
  mounted() {
    this.boxId = this.$route.query.id;
    console.log(this.boxId);
    this.getObjBoxInfo()
  },
  // 自定义方法
  methods: {
    getObjBoxInfo() {
      getObjBoxInfo({ id: this.boxId }).then((res) => {
        if (res.code == 200) {
          this.info = res.data;
        }
      });
    },
  
  },
};


</script>
<style lang="less" scoped>
/*滚动条整体样式*/
::-webkit-scrollbar {
  width: 4px;
  height: 10px;
}

/*滚动条里面小方块*/
::-webkit-scrollbar-thumb {
  border-radius: 10px;
  background: #48a0f8;
}

/*滚动条里面轨道*/
::-webkit-scrollbar-track {
  border-radius: 10px;
  background: #ededed;
}

.detail-content {
  // position: absolute;
  // top: 0;
  // bottom: 0;
  min-height: calc(100vh - 90px);
  width: 100%;
  background: #2A2D3C;

  // flex-direction: column;
  .detail-container {
    margin-top: 39px;
    display: flex;

    .left-container {
      width: 47.72%;
      border-right: 5px solid #373B44;
    }

    .status-box {
      width: 100%;
      height: 12rem;
      border-bottom: 5px solid #373B44;
      border-radius: 6px;
      padding-left: 50px;
      padding-top: 25px;
      position: relative;

      .label {
        color: white;
        font-size: 1.91rem;
        margin-top: 11px;
      }

      .value {
        color: #0DCC24;
        font-size: 2.21rem;
        margin-top: 1.11rem;
      }

      .organe {
        color: #EFC000;
      }

      .status {
        width: 5.57rem;
        height: 5.57rem;
        position: absolute;
        top: 3.17rem;
        left: 15.5rem;
      }
    }

    .jczt-box {
      width: 90%;
      height: 47.93rem;
      padding-left: 50px;
      padding-top: 25px;
    }

    .title {
      display: flex;
      align-items: center;
      font-size: 1.43rem;
      font-weight: bold;
      color: #FFFFFF;
      margin-bottom: 12px;

      .circle {
        width: 5px;
        height: 5px;
        background: #2CE11A;
        border-radius: 50%;
        margin-right: 5px;
      }
    }

    .jklist {
      width: 100%;
      max-height: 90%;
      margin-top: 1.5rem;
      padding: 20px 28px;
      background: #F2F2F2;
      border-radius: 7px;
      display: flex;
      flex-direction: column;
      justify-content: space-around;

      .item {
        width: 90%;
        height: 5rem;
        display: flex;
        align-items: center;
        display: flex;
        justify-content: space-between;

        .label {
          width: 60%;
          text-align: center;
          color: #333333;
          font-size: 1.43rem;
          font-family: MicrosoftYaHei;
        }

        .value {
          width: 185px;
          height: 45px;
          border: 1px solid rgba(124, 124, 124, 0.26);
          background-image: url(../../../../assets/box/num.png);
          background-size: 185px 45px;
          background-repeat: no-repeat;
          text-align: center;
          color: #333333;
          font-size: 21px;
          line-height: 27px;
        }
      }
    }

    .zt-box {
      width: 50%;
      margin-top: 39px;
      display: flex;
      align-items: flex-start;
    }

    .kgzt-box {
      margin-left: 6rem;

      .title {
        display: flex;
        align-items: center;
        font-size: 1.43rem;
        font-weight: bold;
        color: #FFFFFF;

        .circle {
          width: 5px;
          height: 5px;
          background: #2CE11A;
          border-radius: 50%;
          margin-right: 5px;
        }
      }

      .kgzt-content {
        width: 100%;
        padding: 20px 0px;

        .list {
          display: flex;
          flex-wrap: wrap;

          .item {
            width: 13.71rem;
            height: 7.86rem;
            background: #F2F2F2;
            border-radius: 6px;
            border: 1px solid rgba(124, 124, 124, 0.12);
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            margin-right: 5rem;
            margin-bottom: 1.23rem;

            .kgztline {
              display: flex;
              align-items: center;

              .line {
                position: relative;
                width: 6.5rem;
                height: 2.71rem;
                background: #2DE21B;
                border-radius: 1.36rem;
                line-height: 2.71rem;
                margin-right: 1.83rem;
                padding: 0 10px;
                color: #FFFFFF;
                text-align: right;
                font-size: 1.29rem;

                .kai {
                  position: absolute;
                  width: 3.07rem;
                  height: 3.07rem;
                  top: -3px;
                  left: -11px;
                }

                .guan {
                  position: absolute;
                  width: 3.07rem;
                  height: 3.07rem;
                  top: -3px;
                  right: -11px;
                }
              }

              .lineguan {
                text-align: left;
                background: #EEEEEE;
                box-shadow: inset 0rem 0.07rem 0.21rem 0rem rgba(137, 137, 137, 0.5);
                font-size: 1.29rem;
                color: #B0B0B0;
              }

              .status {
                width: 2.57rem;
                height: 2.57rem;
              }

              .statusyc {
                width: 20px;
                height: 20px;
                border-radius: 50%;
                margin-left: 5px;
                background: linear-gradient(360deg, #B0B0B0 0%, #FFFFFF 100%);
              }
            }

            .word {
              width: 100%;
              text-align: center;
              margin-top: 1.09rem;
              color: #333333;
              font-size: 1.29rem;
            }
          }
        }

        .moshi {
          display: flex;
          align-items: center;
          color: #333333;
          font-size: 1.29rem;
          margin: 1rem 0 1.5rem 0;
        }

        .wsmoshi {
          display: flex;
          align-items: flex-start;
          color: #333333;
          font-size: 1.29rem;
          margin: 1rem 0 1.5rem 0;

          .title {
            width: 140px;
          }

          .zlist {
            display: flex;
            flex-wrap: wrap;
          }
        }
      }
    }

    .itemR {
      width: 7.07rem;
      height: 2.79rem;
      text-align: center;
      line-height: 2.79rem;
      background-color: #E8E8EA;
      border: 0.07rem solid rgba(124, 124, 124, 0.12);
      border-radius: 0.29rem 0rem 0rem 0.29rem;
    }

    .itemL {
      width: 7.07rem;
      height: 2.79rem;
      text-align: center;
      line-height: 2.79rem;
      background-color: #E8E8EA;
      border: 0.07rem solid rgba(124, 124, 124, 0.12);
      border-radius: 0rem 0.29rem 0.29rem 0rem;
    }

    .itemC {
      width: 7.07rem;
      height: 2.79rem;
      text-align: center;
      line-height: 2.79rem;
      background-color: #E8E8EA;
      border: 0.07rem solid rgba(124, 124, 124, 0.12);
    }

    .xz-item {
      color: #FFFFFF;
      background-color: #35BB28;

    }
  }

}
</style>